import serve from '../../util/Http.js'
import qs from 'qs'
export default{
    // 管理员
    recommanage(data){
        return serve({
            method:'get',
            params:{
                _gp:'admin.advertisement',
                _mt:'queryAdvertisement',
                adType:data.adType,
                status:data.status,
                pageNo:data.currentPage,
                limit:data.eachpage
            }
        })
    },
    // 删除
    deletes(data){
        console.log(data)
        return serve({
            method:'post',
            params:{
                _gp:'admin.advertisement',
                _mt:'deleteAdvertisement',
               ...data
            }
        })
    },
     // spu树
     category(){
        return serve({
            method:'get',
            params:{
                _gp:'admin.goods',
                _mt:'getSpuBigTree',
            }
        })
    },
    // 添加
    addition(data){
        return serve({
            method:"post",
            data:qs.stringify({
                _gp:'admin.advertisement',
                _mt:'addAdvertisement',
                ...data,
                color:'rgb(122, 194, 182)',
                url:'/pages/product/list?tid='+data.url
            })
        })
    },
     // 编辑
     compile(data){
        return serve({
            method:"post",
            data:qs.stringify({
                _gp:'admin.advertisement',
                _mt:'updateAdvertisement',
                ...data,
                color:'rgb(122, 194, 182)',
                adId:data.id,
                status:data.status=='冻结'? 1 : 2,
                url:'/pages/product/detail?tid='+data.url,
                adType:data.adType=data.adType=='轮播'?1:data.adType=='分类精选'?2:data.adType=='横幅'?3:data.adType=='横幅首页轮播下5按钮'?4:''
            })
        })
    }
}